// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   DataValue.java

package com.oa.workflow;

import com.oa.database.DataConn;
import com.oa.database.QueryData;
import com.oa.share.CheckPartner;
import com.oa.util.Format;
import java.io.PrintStream;
import java.sql.ResultSet;
import java.util.HashMap;

// Referenced classes of package com.oa.workflow:
//            DataValueInfor

public class DataValue
{

    private HashMap hashMap;
    private DataValueInfor dataValueInfor;
    private String str_error;
    private DataConn dataConn;
    private QueryData queryData;
    private Format format;
    private ResultSet rs;
    private String sTable;
    private String sField;
    private String sCond;
    private static boolean strVERSION_F = false;
    private static String strVERSION_M = "workflow==OAVER20050609";

    public static String getVERSION_M()
    {
        return strVERSION_M;
    }

    public DataValue()
    {
        hashMap = null;
        dataValueInfor = null;
        str_error = "";
        dataConn = null;
        queryData = null;
        format = null;
        rs = null;
        sTable = "";
        sField = "";
        sCond = "";
    }

    public DataValue(DataConn dataConnection)
    {
        hashMap = null;
        dataValueInfor = null;
        str_error = "";
        dataConn = null;
        queryData = null;
        format = null;
        rs = null;
        sTable = "";
        sField = "";
        sCond = "";
        dataConn = dataConnection;
        queryData = new QueryData(dataConn);
        format = new Format();
    }

    public String getErrorMessage()
    {
        return str_error;
    }

    public DataValueInfor getDataValueInfor()
    {
        return dataValueInfor;
    }

    public HashMap getDataValueList()
    {
        return hashMap;
    }

    public boolean setDataList(String sTableName)
    {
        hashMap = new HashMap();
        sTable = sTableName;
        sField = "GLID,GLMC,GLSM,GLMR";
        sCond = "GLID<>0";
        if(!strVERSION_F)
        {
            strVERSION_F = CheckPartner.isSameVersion(strVERSION_M);
            if(!strVERSION_F)
            {
                System.out.println("Version Error===" + strVERSION_M.substring(0, 15));
                return false;
            }
        }
        queryData.setMultRecordSet(sTable, sField, sCond);
        str_error = queryData.getErrorMessage();
        rs = queryData.getResultSet();
        try
        {
            while(rs.next()) 
            {
                dataValueInfor = new DataValueInfor();
                int id = rs.getInt("GLID");
                dataValueInfor.setId(id);
                dataValueInfor.setName(rs.getString("GLMC"));
                dataValueInfor.setDesc(rs.getString("GLSM"));
                dataValueInfor.setDef(rs.getInt("GLMR"));
                hashMap.put(new Integer(id), dataValueInfor);
            }
        }
        catch(Exception e)
        {
            str_error = e.getMessage();
            return false;
        }
        return true;
    }

    public boolean deleteData(int flow_id)
    {
        return true;
    }

}
